
/**
  ******************************************************************************
  * Copyright 2021 The Microbee Authors. All Rights Reserved.
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
  * 
  * http://www.apache.org/licenses/LICENSE-2.0
  * 
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  * 
  * @file       fmu_analogin_config.h
  * @author     baiyang
  * @date       2022-10-25
  ******************************************************************************
  */

#pragma once

#ifdef __cplusplus
extern "C"{
#endif

/*----------------------------------include-----------------------------------*/

/*-----------------------------------macro------------------------------------*/
/// 以下注释掉的宏在rtconfig.h中定义
/// HAL_BATT_VOLT_PIN，检测电池电压的ADC通道
/// HAL_BATT_CURR_PIN，检测电池电流的ADC通道
/// HAL_BATT_VOLT_SCALE的含义是电压*100，Kconfig不支持浮点数，所以做乘100处理
/// HAL_BATT_CURR_SCALE的含义是电压*100，Kconfig不支持浮点数，所以做乘100处理
//#define HAL_BATT_VOLT_PIN 2
//#define HAL_BATT_CURR_PIN 3
//#define HAL_BATT_VOLT_SCALE 1100
//#define HAL_BATT_CURR_SCALE 1100

// ADC config
//#define ANALOG_VCC_5V_PIN 4
//#define HAL_HAVE_BOARD_VOLTAGE

#if 0
struct analogin_pin_info {
    const char dev_name[12];
    rt_adc_device_t analogin_dev;
    const uint8_t channel;
    float scaling;
};
#endif

// 宏定义按照analogin_pin_info结构体设置

// BATT_VOLTAGE_SENS
#define HAL_ANALOG_PIN1 { {"adc1"}, \
        NULL, \
        2, \
        (3.3f / (1 << 12)) \
        }

// BATT_CURRENT_SENS
#define HAL_ANALOG_PIN2 { {"adc1"}, \
        NULL, \
        3, \
        (3.3f / (1 << 12)) \
        }

#define HAL_ANALOG_PINS HAL_ANALOG_PIN1,HAL_ANALOG_PIN2

/*----------------------------------typedef-----------------------------------*/

/*----------------------------------variable----------------------------------*/

/*-------------------------------------os-------------------------------------*/

/*----------------------------------function----------------------------------*/

/*------------------------------------test------------------------------------*/

#ifdef __cplusplus
}
#endif



